// 泛型函数重载
import {quickSort} from "./7-2"
var chineseArr = ["武汉","石家庄","郑州","太原","济南","沈阳","大连"]

let cnStr="武汉";
let cnStr2="郑州"
console.log(cnStr2.localeCompare(cnStr,"zh-CN"));

function sortChinese(arr:Array<string>):Array<string>{
    return arr.sort(function(preStr,curStr){
        return preStr.localeCompare(curStr,"zh-CN")
    })
    console.log('arr',arr)
    return arr
}

console.log(sortChinese(chineseArr));

// 判断是否是中文
function isChinese(arr:Array<string>):boolean{
    var pattern = /[\u4e00-\u9fa5]/g
    return chineseArr.some(function(item){
        return pattern.test(item)
    })
}

export {}